package com.aircity.commonuse.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * desc : 属性监听器
 * author : gongfangchao
 * date : 2019/6/3
 * Copyright (c) 2015 jigoon
 **/
@WebListener
public class AttributeListener implements ServletContextListener {

    private final Logger logger = LoggerFactory.getLogger(AttributeListener.class);

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //项目根路径
        sce.getServletContext().setAttribute("base", sce.getServletContext().getContextPath());
        logger.info("Custom Attribute loaded!");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }

}
